package cn.wei.youvie.domain.vo;

import cn.wei.youvie.domain.entity.Chapter;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.List;

@Data
public class ChapterVO implements Serializable {

    private Integer chapterId;

    /**
     * 书籍的 ID，外键关联 books 表
     */
    private Integer bookId;

    /**
     * 章节编号，用于章节排序
     */
    private Integer chapterNumber;

    /**
     * 段落内容
     */
    private List<SectionVO> sections;

    /**
     * 章节标题
     */
    private String title;

    public static ChapterVO objToVo(Chapter chapter) {
        ChapterVO vo = new ChapterVO();
        BeanUtils.copyProperties(chapter, vo);
        return vo;
    }
}
